package com.corona.game;

import com.corona.Game;

import java.util.Locale;

/* compiled from: Battle.java */
/* access modifiers changed from: package-private */
/* loaded from: pokewilds.jar:com/pkmngen/game/DetectEnemyFaint.class */
public class DetectEnemyFaint extends Action {
    public Action.Layer layer;
    public boolean checkEndOfBattle;

    public DetectEnemyFaint(Action nextAction) {
        this(true, nextAction);
    }

    public DetectEnemyFaint(boolean checkEndOfBattle, Action nextAction) {
        super(new Object[0]);
        this.layer = Action.Layer.gui_129;
        this.checkEndOfBattle = true;
        this.checkEndOfBattle = checkEndOfBattle;
        this.nextAction = nextAction;
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        game.actionStack.remove(this);
        if (game.battle.oppPokemon.currentStats.get("hp").intValue() <= 0) {
            Action nextAction = new EnemyFaint(game, new RemoveDisplayText(new DisplayText.Clear(game, new WaitFrames(game, 3, new DisplayText(game, "Enemy " + game.battle.oppPokemon.nickname.toUpperCase(Locale.ROOT) + " fainted!", (String) null, (Action) null, (Action) null)))));
            if (this.checkEndOfBattle) {
                nextAction.append(new CheckEndOfBattle(null));
            } else {
                nextAction.append(this.nextAction);
            }
            game.insertAction(nextAction);
            return;
        }
        game.insertAction(this.nextAction);
    }
}
